#if !defined(_SERVER_H_)
#define _SERVER_H_

#include <boost/asio.hpp>
#include <string>
#include <vector>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>

#include "controllers_network.h"
#include "con_connection.h"
#include "options.h"
#include "sqlhandle.h"

class server
  : private boost::noncopyable
{
    public:

		explicit server(const server_parameters::remote_point &_listen_point, std::size_t _io_service_pool_size, uid_t _user = 0, gid_t _group = 0);

		void run();

		void stop();

		controllers_network network_;

		sqlhandle sqlhandle_;

    private:

		void handle_accept(const boost::system::error_code& e);

		boost::asio::io_service m_io_service;

		boost::asio::ip::tcp::acceptor m_acceptor;
	
		con_connection_ptr m_new_con_connection;

		std::vector<boost::shared_ptr<boost::thread> > threads_pool_;

		std::size_t io_service_pool_size_;

};

#endif // _SERVER_H_

